package my.jieh.tips.tiger;

/**
 * <p>Title: Core Java Technologies Tech Tips</p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2002</p>
 *
 * <p>Company: Blueimp</p>
 *
 * @author jieh
 * @version 1.0
 */
public class GenericExample {
  static <F extends Food> void feed
    (Animal<F> animal, F food) {
        animal.eat(food);
    }

  public static void main(String... args) {
     feed(new Lion(), new Antelope());
  }
}

class Antelope implements Food, Animal<Grass> {
   public int glycemicIndex() {
      return 5; //this is a made up number
   }

   public void eat(Grass food) {
   }
}

class Lion implements Animal<Antelope> {

   public void eat(Antelope food) {
   }
}

 class Grass implements Food {
    public int glycemicIndex() {
       return 20; //this is a guess, don't base your diet
                  // on this
    }
 }

 interface Food {
    int glycemicIndex();
 }

 interface Animal <F extends Food> {
    public void eat(F food);
 }
